require([ "require-config" ], function() {
    require([ 'jquery', 'validate' ], function() {
        $('form').validate({
            rules : {
                account: {
                	memberAccount: true
                },
                account: {
                	memberNumStatus: true
                },
                account: {
                	memberSee: true
                }
            },
            messages : {
            	memberAccount: {
                    required: '登录账户不能为空'
                },
                memberNumStatus: {
                    required: '报号状态不能为空'
                },
                memberSee: {
                    required: '查看人不能为空'
                }
            },
            submitHandler : function(form) {
            	var id_array=new Array();  
            	$('input[name="sees"]:checked').each(function(){  
            	    id_array.push($(this).val());//向数组中添加元素  
            	});  
            	var idstr=id_array.join(',');//将数组元素连接起来以构建一个字符串  
            	alert(idstr);  
                $.ajax({
                    url: 'edit',
                    type: 'POST',
                    data: {
                        'memberAccount': $('#memberAccount').val(),
                        'memberNumStatus': $('#memberNumStatus').val(),
                        'memberSee': idstr
                    },
                    dataType: 'json',
                    beforeSend: function() {
                        $("#frm_submit").attr("disabled", true);
                    },
                    success: function(response) {
                        if (true == response.success) {
                            window.location.href = 'list';
                        } else {
                            alert(response.message);
                        }
                        $("#frm_submit").attr("disabled", false);
                    },
                    error: function() {
                        $("#frm_submit").attr("disabled", false);
                    }
                });
            }
        });
    });
});